<template>

<div id="message">

  <van-nav-bar
  title="消息列表"
  left-text="返回"
  left-arrow
  class="header"
  @click-left="$router.back(-1)"
/>
<!-- // 头部 -->
<van-pull-refresh v-model="isLoading" @refresh="onRefresh">

<list :list='list'></list>

<div class="more" v-if="moreshow" >

<img src="static/img/more.png" alt="">
</div>
<div style="height:2.2rem"></div>
</van-pull-refresh>

<app-footer></app-footer>
</div>


</template>


<script>
import AppFooter from '@/pages/Commons/Footer.vue'
import List from '@/pages/Message/comments/list.vue'
import Axios from 'axios';

export default{
  components:
  {
    AppFooter,List
  },
data(){
  return{
    isLoading: false,
count:'',
list:'',
moreshow:false
  }
},
methods:{
  onRefresh() {
this.getlist()
      setTimeout(() => {
        this.$toast('刷新成功');
        this.isLoading = false;
        this.count++;
      }, 500);
    },
    getlist(){
       var token = localStorage.getItem('token')

Axios.get('/api/message/list',{
  headers: {
            'Authorization': 'Bearer ' + token
        },

      })
      .then((response) => {
        console.log(response.data);//请求的返回体
        this.list=response.data
        if(response.data.data==""){
          this.moreshow=true

        }
      })
      .catch((error) => {
        console.log(error);//异常
      });//获取用户信息
    }
},
mounted(){
this.getlist()

}

}
</script>



<style>
.more{width: 35%;height: 35%;margin-left: 30%;margin-top: 15%}
.more img{width: 100%;height: 100%}
#message{

}
.headers{
  width: 100%;height: 12rem;background:#259E7B;position: relative
}
.header{
    background: #259e7b;
    color: white
}
.van-icon-arrow::before,.van-nav-bar__text{color: white}
</style>
